When traveling, many drivers often experience an unexpected full car park when they reach their destination, leaving them with no choice but to roam around the area until they find a car park with a free lot for them to park their vehicle. Unexpected delays in drivers’ schedules are introduced as drivers spend additional time finding a car park lot. This issue is especially acute if the drivers are unfamiliar with the area around their destination, and do not have sufficient knowledge on the available car parks around them. Eventually, this reduces and removes the original and fundamental benefits of driving for the drivers - higher accessibility and shorter traveling time.
Although there are several websites and governmental data sources providing different types of car park information in Singapore, these data sources are generally separate and not synthesized currently - most websites only report data on the car parks under some specific operators and not all (in Singapore, there are different car park operators like HDB, URA, private shopping malls etc); APIs for real-time car park availability data do not contain other information about the car parks, such as their parking rates, whether they provide night parking, or their type (basement/multi-storey/surface/etc). However, these information will affect drivers’ decision regarding which car park to park their vehicle at. To retrieve full information on the car parks around them, drivers now have to go to different websites to organize and synthesize these information themselves - this requires additional effort.
As such, parkwhere.sg aims to be the first Singaporean website to provide a one-stop application for drivers to get real-time carpark availability data and other important information on the car parks around their destination conveniently. Drivers who are not intending to travel immediately can also get predicted car park availability based on past data, so that they can plan their travel and parking more efficiently. Not only so, understanding that drivers’ decisions to park their vehicles also depend on the weather (when it’s raining, drivers prefer to park at sheltered car parks), our application incorporates current weather data and car park types so that drivers can make better parking decisions.
| Information | Data Source | Data Type | Link |
|---|---|---|---|
| Car Park Availability | data.gov.sg | API, JSON | https://api.data.gov.sg/v1/transport/carpark-availability |
| Car Park Information | data.gov.sg | csv file | https://data.gov.sg/dataset/hdb-carpark-information |
| Coordinates Conversion | OneMapSG | API, JSON | https://docs.onemap.sg/#3414-svy21-to-4326-wgs84 |
| Weather Information | OpenWeatherMap | API, JSON | https://openweathermap.org/current |
For real-time car park availability data, we obtain the information from a government API: https://api.data.gov.sg/v1/transport/carpark-availability.
((talk about mongoDB))
For information on car parks, we used a governmental data set from https://data.gov.sg/dataset/hdb-carpark-information. However, this data set provides the car park location in SVY21 format (a special coordinate format). As ggmap in R uses WGS84 coordinate format instead, we have to transform the coordinates data accordingly.
To do this, we utilized a coordinate converter API from OneMapSG to transform the coordinates from 3414(SVY21) to 4326(WGS84) format. The API’s documentation can be retrieved from: https://docs.onemap.sg/#3414-svy21-to-4326-wgs84. As there are over 2000 car parks in our data, we experienced timeout issues while calling the API 2000 times. Thus, we had to ignore the timeout error so that the loop will continue running (generally, ignoring errors is not recommended, unless you know the origin of the error and are sure that it will not affect the application/code).
#the following code is included in this report for reference as it is not in our project zip file
library(jsonlite)
url<- 'https://developers.onemap.sg/commonapi/convert/3414to4326?X='
data <- read.csv('raw_hdb_carpark.csv')
data <- data[, c(1,3,4)]
data$lat = 0
data$lon = 0
for (i in 1:nrow(data)) {
tryCatch({
x = data[i,2]
y = data[i,3]
url_exact = paste0(url, x, "&Y=", y)
lon_lat_data <- fromJSON(url_exact)
data$lat[i] = lon_lat_data$latitude
data$lon[i] = lon_lat_data$longitude
},
error = function(e){})
}
Lastly, not all car parks in the data set has corresponding real-time availability data from the car park availability. Therefore, we have to clean the data further to only include car park information for the car parks that have real-time lot availability data.
Our final cleaned data set on car park information is named hdb_available_query.csv.
For current weather information, we used the OpenWeather API to retrieve current weather conditions by geographical coordinates from: https://openweathermap.org/current.
When the user first opens the application, he will see a full map view of Singapore with markers indicating the location of all car parks. Clustering on leaflet is used at a certain level so that the map does not look too clustered. Only when the user zooms in will he be able to see individual marker points for each car park location.
Map Markers: refer to next section for a view of the individual map markers
If the user would like to see car parks near his location, he can also click the “Get Your Location” button located at the top left corner of the Leaflet map (below the zoom buttons), to allow the application to retrieve his location and zoom in to see only the car parks near his current location.
If the user is not intending to travel now and thus requires future car park lot availability instead, he can also input his intended travel time using the ‘time to predict’ slider input. Doing so will show the predicted car park lot availability in map view. Car park lot availability is predicted using past data.
((explain methodology!!))
Apart from being able to zoom into his current location, user can also input his destination’s postal code or address to view the car parks near his destination. Upon the user clicking “Enter” or the “show carparks” button (done using ObserveEvent()), his input in postal code/address will be transformed into coordinates using Google Geolocation API. Thereafter, the map will react to center on the location of his destination, by using the leaflet function fitBounds().
If the user inputs an invalid destination, there will be no zooming on the map, and a corresponding error message reminding users to input valid address/postal code will appear. If the user inputs a destination that is not in Singapore, the map will still zoom accordingly, but a warning highlighting that the location does not seem to be Singapore will be shown. These warnings that react according to the input value use package ShinyFeedback().
On the top right corner of the application page, there is a cloud icon which upon clicking, shows a drop down menu of current weather updates according to general locations.
Users can use this information to decide if he wants to look out for sheltered or surface car parks in his destination (note: in wet weather, users are likely to prefer sheltered car parks). The current weather is retrieved from the OpenWeatherMap Current Weather API using geographical coordinates. The coordinates of the general areas in Singapore (Central, North, South, East, West) were retrieved from a separate governmental weather forecast API that provided coordinates of different areas in Singapore (we chose not to use this API as its weather conditions were too vague and its area demarcation were too specific to be of great relevance to drivers).
Users can choose to filter car parks according to its type or availability status to show only the type of car parks that they prefer or only empty car parks. Users can use these filter, for example, in wet weather, to only show multi-storey or basement car parks that are sheltered.
((explain how the filtering works!!!!!!))
When the user clicks on a specific car park marker, other information on that specific car park will be shown below the original map.
Every marker on the map has a specific markerID defined to be its car park number. When a click on the map marker is observed, we retrieve the marker’s ID.
Using the marker’s ID (i.e. the car park number), we filter out its availability data and plot a ggplot to show the number of lots available at that car park for the past and next (predicted) 24 hours. Data for the next 24 hours are predicted using the same methodology as explained above.
We also filter out the specific car park’s corresponding data from our car park information dataframe, and render its information as a table. From this table, users will be able to obtain additional information on the car park like its address, type, parking system, and parking allowances (grace periods/night parking/free parking).
Using the location of the car park, we also retrieve the current weather at the specific car park from our weather API and display it similarly as a table. This weather information is useful for car parks that are not in well-defined areas (e.g. users may not be sure whether Choa Chu Kang is considered in the North or West). Additionally, weather updates on the main page of the application is for general areas and may differ at specific locations. The weather icons here change according to the weather condition, providing a more intuitive aesthetic for users.
To improve the look of our application, we have added a custom CSS file to style our application. This also increases the flexibility of our application’s aesthetics, as we can change the font, color scheme or other aesthetic behavior according to users’ feedback.
For an application like ours, it is extremely important that users can use the application even on the go. The effectiveness of our application will be greatly reduced if drivers could only use it on computer since they will not be able to receive the most updated availability data while traveling. Originally empty car parks can become full while users travel there, and predicted car park availability may not tackle the issue as effectively as the actual current car park availability.
Therefore, our application is also mobile friendly and optimized.
((explain))
Currently, our application only shows the data on car parks under Singapore’s Housing Development Board (HDB). A possible future development is to include car parks under other statutory boards like the Urban Redevelopment Authority (URA), Land Transport Authority (LTA) or private operators (car parks in shopping malls). They are currently not included in our application due to some limitations we face. For one, we are unable to apply for an API key for URA’s and LTA’s car park availability API as we do not have a corporate account. Including all car parks in Singapore in our application will help make us the true one-stop application for drivers to check car park lot availability.
Moving forward, we can also add an algorithm to our application to recommend 2-3 best car parks for the user, based on proximity, availability of car park lots as well as parking rates (or any other criteria that the user can input himself). This will help to reduce the decision-making time for our users, enabling them to optimize their time even further.
A DBA3702 Project by:
Cheng Xin An, ClarenceChua Shao Hwee, JamesLoo Yun Yi, PhyllisNicholas Koh Pei An